package lecture06.person;

/*
对象是类的实例,类是对象的抽象
对象:对象是类的实例,是一个个体
类是对象的抽象,抽象出来对象的属性和行为
类由成员组成:成员属性和成员方法

Person person = new Person(); //创建对象
Person person 声明一个对象person


*/

class Person{
    String name;
    int age;

    public void work() {
        System.out.println("work");
    }
    public void study() {
        System.out.println("study");
//        eat();
    }
    public void sleep() {
        System.out.println("sleep");
    }
    public void eat() {
        System.out.println("eat");
    }
}




public class PersonInf {
    public static void main(String[] args) {
        Person person = new Person();
        person.name = "ln"; // 对象访问属性(对象名.属性名)
        person.age = 18;
        System.out.println(person.name);
        System.out.println(person.age);
        person.work();
        person.study();
        person.eat();
        person.sleep();
        Person p2 = new Person();
        p2.name = "lll";
        System.out.println(p2.name);
    }
}
